package com.usian.article.controller.v1;

import com.usian.apis.article.ApArticleControllerApi;
import com.usian.apis.article.ApArticleHomeControllerApi;
import com.usian.article.service.ApArticleHomeService;
import com.usian.article.service.ApArticleService;
import com.usian.common.constant.article.LoadConstants;
import com.usian.model.article.dtos.ArticleHomeDto;
import com.usian.model.article.dtos.ArticleInfoDto;
import com.usian.model.article.pojos.ApArticle;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName: ApArticleHomeController
 * Author:   WGG
 * Date:    2022-11-2022/11/29-16:11
 * Version: 1.0
 * Description:
 */
@RestController
@RequestMapping("/article/api/v1/article")
public class ApArticleHomeController implements ApArticleHomeControllerApi {


    @Autowired
    private ApArticleHomeService apArticleHomeService;

    @Override
    @PostMapping("/load")
    public ResponseResult load(@RequestBody ArticleHomeDto dto) {
        return apArticleHomeService.load(dto, LoadConstants.LOADTYPE_LOAD_MORE);
    }

    @Override
    @PostMapping("/loadnew")
    public ResponseResult loadnew(@RequestBody ArticleHomeDto dto) {
        return apArticleHomeService.load(dto, LoadConstants.LOADTYPE_LOAD_MORE);
    }

    @Override
    @PostMapping("/loadmore")
    public ResponseResult loadmore(@RequestBody ArticleHomeDto dto) {
        return apArticleHomeService.load(dto, LoadConstants.LOADTYPE_LOAD_NEW);
    }

    @Override
    @PostMapping("/load_article_info")
    public ResponseResult loadNewsById(@RequestBody ArticleInfoDto dto) {
        return apArticleHomeService.loadNewsById(dto);
    }

}
